package com.hulu73.shiro.entity.base;

import java.io.Serializable;

import org.apache.commons.lang3.builder.ReflectionToStringBuilder;

public abstract class BaseEntity<T> implements Serializable {
	private static final long serialVersionUID = 1L;
	protected String id;

	public BaseEntity() {
	}

	public BaseEntity(String id) {
		this.id = id;
	}

	public String getId() {
		return this.id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public boolean equals(Object obj) {
		if (null == obj) {
			return false;
		}
		if (this == obj) {
			return true;
		}
		if (!(super.getClass().equals(obj.getClass()))) {
			return false;
		}
		BaseEntity that = (BaseEntity) obj;
		return ((null == getId()) ? false : getId().equals(that.getId()));
	}

	public String toString() {
		return ReflectionToStringBuilder.toString(this);
	}
}